const axios = require('axios');

// 示例方法：请求其他接口
async function fetchExternalData(url,data) {
  try {
    const accessToken = '';
    const response = await axios.post(url,data,{
      // acw_tc=1a1c720e17367371024451629e9b4bb372784068d2d9b4e19c1fe92153bd5a;path=/;HttpOnly;Max-Age=1800
      headers: {
        'api-version': '1.0',
        'tracestate': 'bnro=android/9_android/8.12.1_okhttp/3.14.9',
        'traceparent': '00-977b1a6ebec44be987b044fb18c7910f-b77bcffa7344068e-01',
        'devicetoken': 'ZywnOHcgMJMDABFVpbuaQ8Nk',
        'deviceid': 'ZywnOHcgMJMDABFVpbuaQ8Nk',
        'requesttag': '9DF09F9B48432E2BDBFAB0CB0D149556',
        'devicetype': '0',
        'platform': 'android',
        'currenttheme': 'Light',
        'package-type': 'uuyp',
        'app-version': '5.27.5',
        'uk': '5CrrXbCP5O7GSbtWI0V7uN6iCYuhH8k4zHBaQg5gjvX9bJBx1CGrWSJ7PW8sLt71G',
        'device-info': '{"deviceId":"ZywnOHcgMJMDABFVpbuaQ8Nk","deviceType":"SM-G9750","hasSteamApp":0,"requestTag":"0BD0B1FFC77CB38B4620B131F9C1AD26","systemName":"Android","systemVersion":"9"}',
        'apptype': '7',
        'authorization': `Bearer `,
        'content-type': 'application/json; charset=utf-8',
        'accept-encoding': 'gzip',
        'user-agent': 'okhttp/3.14.9',
      }
    });
    return response.data;
  } catch (error) {
    console.error('Error fetching external data:', error);
    throw error;
  }
  //   const response = await axios.get(url);
  //   return response.data;
  // } catch (error) {
  //   console.error('Error fetching data:', error);
  //   throw error;
  // }
}

module.exports = {
  fetchExternalData,
};